

public class BottomRay {
    void init(){
        GameUtil.MAX_W = GameUtil.MAX_W_array[GameUtil.difficulty];
        GameUtil.MAX_H = GameUtil.MAX_H_array[GameUtil.difficulty];
        GameUtil.bomb_MAX = GameUtil.bomb_MAX_array[GameUtil.difficulty];

        GameUtil.INIT=false;
        GameUtil.START_TIME=GameUtil.END_TIME=System.currentTimeMillis();
        GameUtil.LEFT=GameUtil.RIGHT=false;
        GameUtil.state=0;
        GameUtil.SUM=0;
        for(int i=0;i<GameUtil.MAX_W;i++)
            for(int j=0;j<GameUtil.MAX_H;j++)
                GameUtil.mp[i][j]=0;
        int cnt = 0;
        while (cnt < GameUtil.bomb_MAX) {
            int x = (int) (Math.random() * GameUtil.MAX_W);
            int y = (int) (Math.random() * GameUtil.MAX_H);
            if (GameUtil.mp[x][y] == 0){
                cnt++;
                GameUtil.mp[x][y] = -1;
                for(int dx=x-1;dx<x+2;dx++) {
                    for (int dy = y-1; dy < y+2; dy++) {
                        if (0<=dx&&dx<GameUtil.MAX_W && 0<=dy&&dy<=GameUtil.MAX_H && GameUtil.mp[dx][dy]!=-1)
                            GameUtil.mp[dx][dy]++;
                    }
                }
            }
        }
        for(int i=0;i<GameUtil.MAX_W;i++)
            for(int j=0;j<GameUtil.MAX_H;j++)
                GameUtil.MAP_TOP[i][j]=1;
    }
}
